exports.canBeAddCustomer = (req, res) => {

    var restfulParams = req.routeInfo.restfulParams;

    var resultData = {};

    var u_id = restfulParams.u_id;

    var weChatMemberArr = [];

    var readRecord = 0;

    var skip = restfulParams.skip == undefined ? 0 : restfulParams.skip;

    var limit = restfulParams.limit == undefined ? 20 : restfulParams.limit;

    //查询客户浏览记录
    function readRecordInfo(cb) {

        R.SEND_HTTP(
            req,
            res,
            {
                url: config.external_server.apiAddress + "/organization/search_art_product_user_read_record/apurr_uid/" + u_id + "/sort_order/apurr_id-desc" + "/skip/" + skip + "/limit/" + limit,
                method: 'GET',
            },
            function (data) {
                console.log(data);

                readRecord = data.result.data;

                cb();

            }
        )
    }

    function screenCustomer(cb) {

        F.ParallelEach(readRecord, function (item, index, callback) {

            //筛选
            function screen(eachCb) {
                R.SEND_HTTP(
                    req,
                    res,
                    {
                        url: CORE_APIConfig.coreAPI.artCustomerSearch.Request_Api_Url + "/count/1/c_is_delete/0/c_openid/" + item.apurr_openid,
                        method: 'POST',
                        data: {
                            fields: ['c_id'].join(",")
                        }
                    },
                    function (data) {

                        if (data.result.data.length > 0) {
                            eachCb();
                        }else{
                            weChatMemberArr.push(item);
                            eachCb();
                        }


                    }
                )
            }


            F.Parallel([
                screen,
            ], () => {
                callback();
            })

        }, cb)

    }

    function weChatMember(cb) {
        resultData.weChatMemberArr = weChatMemberArr;
        cb()
    }

    F.Serial([
        readRecordInfo,
        screenCustomer,
        weChatMember,
    ], () => {
        RES.successResponse(res, resultData);
    })


}